<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑</title>

</head>
<body>
<link rel="stylesheet" th:href="@{/static/layui/css/layui.css}" media="all">
<script type="text/javascript" th:src="@{/static/js/jquery-3.js}"></script>
<script th:src="@{/static/layui/layui.js}" charset="utf-8"></script>

<style type="text/css">
    .layui-form-selectup dl{
        top:42px;
        bottom:unset;
    }
</style>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>修改问题</legend>
</fieldset>

<div class="layui-form-item">
    <label class="layui-form-label">id<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.id}" type="text" aria-readonly="true" name='id' id="id" lay-verify="required" readonly="readonly" autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">fid<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.fid}" type="text" name='fid' id="fid" lay-verify="required" readonly="readonly"  autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">nid<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.nid}" type="text" name='nid' id="nid" lay-verify="required" readonly="readonly"  autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">用户id&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.uid}" type="text" name='uid' id="uid" lay-verify="required" readonly="readonly"   autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">评论内容&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.content}" type="text" name='content' id="content" lay-verify="required" readonly="readonly" autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>


<div class="layui-form-item">
    <label class="layui-form-label">状态&nbsp;:</label>
    <div class="layui-input-block">
        <select name="state" id="state" lay-verify="required" style="width:500px; height: 38px;" class="layui-form-selectup">
            <option th:selected="${discussPO.state == 0}" value="0">删除</option>
            <option th:selected="${discussPO.state == 1}" value="1">未删除</option>
        </select>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">点赞数<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.likes}" type="text" aria-readonly="true" name='likes'  id="likes" lay-verify="required" readonly="readonly" autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">踩次数<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.tread}" type="text" aria-readonly="true" name='tread' id="tread"  lay-verify="required" readonly="readonly" autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">回复次数<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${discussPO.reply}" type="text" aria-readonly="true" name='reply'  id="reply" lay-verify="required" readonly="readonly" autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>


<div class="layui-form-item">
    <label class="layui-form-label">类型&nbsp;:</label>
    <div class="layui-input-block">
        <select name="state" id="typees" lay-verify="required" style="width:500px; height: 38px;" class="layui-form-selectup">
            <option th:selected="${discussPO.typees == 0}" value="0">文章</option>
            <option th:selected="${discussPO.typees == 1}" value="1">回答</option>
        </select>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" class="layui-btn" lay-submit="" lay-filter="editBtn">修改</button>
    </div>
</div>


<script>
    var basePath="/";

    layui.use(['form'],function () {
        var form = layui.form;
        var parentLayer = parent.layer;
        form.on("submit(editBtn)",function () {
            var obj = {
                id:$("#id").val(),//编号
                state:$("#state option:selected").val(),//状态
                typees:$("#typees").val(),//类型
            };
            $.post(basePath+"discuss-update",obj,function (data) {
                if(data.data){
                    parentLayer.msg("修改成功",{
                        icon: 1,
                        time: 10000
                    });
                }else{
                    parentLayer.msg("修改失败",{
                        icon: 1,
                        time: 2000
                    });
                }
                parent.location.reload();
            },"json");

        })
    })









</script>



</body>
</html>